import React from 'react'
import { View } from '@tarojs/components'
import { Menu as MenuDef } from '@/model/declare'

import './index.scss'
import { MenuItem } from './Item'

export interface IMenuProps {
    menus: MenuDef[]
}

/**
 * 菜单入口
 * @param param0 
 */
export const Menu: React.FC<IMenuProps> = ({ menus }) => {

    return (
        <View className="xxm-menu-box">
            <View className="xxm-menu-box__inner">
                {
                    menus.map((menu, idx) => {
                        return (
                           <MenuItem {...menu} key={idx}/>
                        )
                    })
                }
            </View>
        </View>
    )
}